package com.ymttest.database.mongo;

import java.util.List;
import java.util.Map;

import com.ymt.database.MongoDBDriver;

public class StockOperationLogWapper {
	MongoDBDriver mdd = YmtMongoDriverFactroy.getInstance_YmtProductDBdriver("StockOperationLog");
	
	@SuppressWarnings("unchecked")
	public Map<String, Object> getByProductId(String productId) throws Exception{
		  return  mdd.selectPartLimitToMap("{\"ProductId\":\"" + productId + "\"}",1).get(0);
	}
	
	public List<Map> getAllByProductId(String productId) throws Exception{
		  return  mdd.selectPartLimitToMap("{\"ProductId\":\"" + productId + "\"}",50);
	}
	
	public static void main(String[] args) throws Exception {
		System.out.println(new StockOperationLogWapper().getByProductId("dbcb21b5-334e-40e0-bc2e-3b34bd46fac5").get("_id").toString());
	}
	
}
